package HashSet集合存储学生遍历;

import java.util.HashSet;

public class Tes {
    public static void main(String[] args) {
        HashSet<Student> s=new HashSet<Student>();
        Student st=new Student("石昊卿",21);
        Student st1=new Student("张鹏",22);
        Student st2=new Student("贾月月",22);
        Student st3=new Student("贾月月",22);
        s.add(st);
        s.add(st1);
        s.add(st2);
        s.add(st3);
        for (Student s1:s){
            System.out.println(s1.getName()+","+s1.getAge());
        }
    }
}
